<include file="Public:header"/>
<link rel="stylesheet" href="__CSS__/yf.css" />
<body class="J_scroll_fixed">
<div class="wrap J_check_wrap">
    <include file="Public:nav"/>
    <form method="post" class="J_ajaxForm"  action="{:U("Suipai/edit")}" >
    <div class="J_tabs_contents">
        <div>
            <div class="h_a">信息编辑(带红色框为必填项)</div>
            <div class="table_full">
                <table width="100%" class="table_form ">
                    <tr>
                        <th width="100">信息标题：</th>
                        <td><input type="text" name="title" class="input require" size="50" value="{$info.title}"></td>
                    </tr>
                    <foreach name="info.all_pic" item="pic">
                    <tr>
                        <th>图片{$key+1}：</th>
                        <td><Form function="yf_image_two" parameter="$key+1,image,image,$pic['thumb'],$pic['pic'],works"/><span class="gray"> 双击可以查看图片！</span></td>
                    </tr>
                    </foreach>
                    <tr>
                        <th>简介：</th>
                        <td><textarea name="content" id="" cols="90%" rows="10">{$info.content}</textarea></td>
                    </tr>
                    <tr>
                        <th>审核:</th>
                        <td><select name="status">
                                <option value="1" <eq name="info.status" value="1"> selected</eq>>审核</option>
                                <option value="0" <eq name="info.status" value="0"> selected</eq>>不审核</option>
                                <option value="2" <eq name="info.status" value="2"> selected</eq>>不通过审核</option>
                            </select>
                        </td>
                    </tr>
                </table>
            </div>
        </div>

    </div>
    <div class="btn_wrap">
        <div class="btn_wrap_pd">
            <input type="hidden" name="id" value="{$info.id}"/>
            <button class="btn btn_submit mr10 J_ajax_submit_btn" type="submit">提交</button>
        </div>
    </div>
    </form>
</div>
<script type="text/javascript" src="__JS__/common.js"></script>
<script type="text/javascript" src="__JS__/content_addtop.js"></script>
<script type="text/javascript" src="__JS__/kindeditor.js"></script>
<script>
KindEditor.ready(function(K) {
	var YF = {
			siteUrl: "__ROOT__/",
			};
	$("input[class^='hy-uploadimg']").each(function(i, v) {
		var _this = this;
		var index = i;
		var args =$('.yf-pic-'+(index+1)).attr('data-args') ? '&args=' + $('.yf-pic-'+(index+1)).attr('data-args') : '';
		var setting = '&module=' + $('.yf-pic-'+(index+1)).attr('data-mod') + '&authkey=' + $('.yf-pic-'+(index+1)).attr('data-authkey');
		var upload_url = YF.siteUrl + 'index.php?a=yf_sign&c=Files&m=Upload&num='+ index + args + setting;
		
		var _callback = function(data) {
			    if(data.error == 0)
			    {
			    	var img_path = data.content.path + "yf_" + data.content.savename;
			    	var pic_path = data.content.path + data.content.savename;
				    $('.yf-pic-'+data.num).val(img_path);
				   // $('#yf-image-'+data.num).attr('src', "../."+img_path);
				    $('.yf-pic-'+data.num).attr('data-pic', pic_path);
			    }
			    else
			    {
			    	alert(data.content);
			    }
			}
		var uploadbutton = K.uploadbutton({
			button: _this,
			fieldName: 'file_name'+index,
			url: upload_url,
			afterUpload: _callback,
			afterError: function(str) {
				alert('自定义错误信息: ' + str);
			}
		});
		uploadbutton.fileBox.change(function(e) {
			uploadbutton.submit();
		});
	}); //each
});
</script>
</body>
</html>